package com.wingscode.modules.common.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.wingscode.common.validator.group.AddGroup;
import com.wingscode.common.validator.group.UpdateGroup;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;

/**
 * 广告
 *
 * @author yan
 */
@Data
@TableName("tb_advertisement")
public class AdvertisementEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     *
     */
    @TableId
    private Long id;
    /**
     * 创建时间
     */
    @TableField("create_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
    private Date createTime;
    /**
     * 更新时间
     */
    @TableField("update_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
    private Date updateTime;
    /**
     * 标题
     */
    private String title;
    /**
     * 内容
     */
    private String content;
    /**
     * 图片链接
     */
    private String img;
    /**
     * 用户id
     */
    @TableField("user_id")
    private Integer userId;
    /**
     * 跳转链接
     */
    private String url;
    /**
     * 状态（0：下架；1：上架）
     */
    private Integer status;
    /**
     * 1-资讯 2-广告
     */
    @NotNull(message="type不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Integer type;
    /**
     * 类型id
     */
    @TableField("dic_id")
    private Integer dicId;
    /**
     * 排序
     */
    private Integer sort;
    @TableField(exist = false)
    private String userName;
    @TableField(exist = false)
    private String dicName;
}
